# coding=utf-8

import pandas as pd;
import plotly_express as pe;

path = '../data.xlsx';
# id 中文名	采集人	采集年份	采集日期	采集地(省)	采集地(县)	采集海拔(m)	鉴定人	鉴定年份
data_excel = pd.read_excel(path, sheet_name='Sheet1');
"""
x_name=data_excel['中文名'];
y_altitude=data_excel['采集海拔(m)'];
y_getPerson=data_excel['采集人'];
y_usePerson=data_excel['鉴定人'];
y_userYear=data_excel['鉴定年份'];
y_getProvince=data_excel['采集地(省)'];
y_getCounty=data_excel['采集地(县)'];
y_getYear=data_excel['采集年份'];
"""

#print(pe.data.gapminder())


# 显示data
def show_data(x, y, viewer):
    data1 = pd.DataFrame({x: data_excel[x], y:  data_excel[y], '采集地(省)': data_excel['采集地(省)']});
    print(data1);


def showViewer(x, y, viewer):
    print(x, y, viewer)
    datax = data_excel[x];
    datay = data_excel[y];
    dataz = data_excel['采集地(县)']
    data1 = pd.DataFrame({x: datax, y: datay,'采集地(县)': dataz});
    if viewer == '散点图3D':
        pe.scatter_3d(data1, x=x, y=y,z='采集地(县)').show();
    elif viewer == '散点图':
            pe.scatter(data1, x=x, y=y).show();
    elif viewer == '线条图':
        pe.line(data1, x=x, y=y).show();
    elif viewer == '区域图':
        pe.area(data1, x=x, y=y).show();
    else:
        pe.histogram(data1, x=x, y=y).show();


